﻿#ifndef MAIN_WINDOW_H
#define MAIN_WINDOW_H

#include <Base/Interface/DockWidgetRegister.h>
#include <ctkPluginFrameworkFactory.h>

#include <QDockWidget>
#include <QMainWindow>
#include <QTimer>

#include "SARibbon.h"
#include "service/event/ctkEventAdmin.h"
#include "service/event/ctkEventHandler.h"
namespace Ui {
class MainWindow;
}
class ctkPluginException;
class ctkPluginFramework;
class ctkPluginContext;
class ctkPlugin;
class MenuBar;
class MainWindow : public SARibbonMainWindow {
  Q_OBJECT

 public:
  explicit MainWindow(QWidget* parent = nullptr);
  ~MainWindow();

  void InitPluginFrameWork();

  void LoadPlugins();

  void LoadPluginsInDirectory(const QString& plugins_dir);

  void LoadAndStartPlugin(const QString& plugin_path);

  void InitDockManager();

  void InitMenuAndActions();

 private:
  void SendEvent(const QString topic, const ctkDictionary& dict);

 private:
  Ui::MainWindow* ui;

  SARibbonBar* ribbon_bar_;

  MenuBar* menu_bar_;
  ctkPluginFrameworkFactory frame_work_factory_;
  QSharedPointer<ctkPluginFramework> framework_;
  ctkPluginContext* plugin_context_;
  QSharedPointer<ctkPlugin> plugin_;
  QTimer timer_;
  ctkServiceReference reference_;
  IDockWidget* hello_service_;
};

#endif  // MAIN_WINDOW_H
